import re

from conf.settings import PATTERN
from libs.GlobalVariables import global_v


def patameters_replace(content):
    '''
    通过正则匹配表达式匹配到相应的内容，之后用获取到接口返回的key的值 replace 掉（.*?）的内容
    :param content:
    :return:
    '''
    keys = re.findall(PATTERN,content)
    for key in keys:
        value = global_v.getVar(key)
        content = content.replace('${'+ key + '}',str(value))
    return content